﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Gronia.WPF.Controls">

    <Style TargetType="{x:Type local:BusyIndicator}">
        <Setter Property="BusyContent" Value="İşleminiz Gerçekleştiriliyor..." />
        <Setter Property="BusyTitle" Value="Lütfen Bekleyiniz..."/>
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Focusable" Value="False" />
        <Setter Property="OverlayStyle">
            <Setter.Value>
                <Style TargetType="Rectangle">
                    <Setter Property="Fill" Value="White" />
                    <Setter Property="Opacity" Value="0.5" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:BusyIndicator}">
                    <Grid>
                        <ContentControl x:Name="Content" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsTabStop="False" Focusable="False" />
                        <Rectangle Visibility="Collapsed" x:Name="Overlay" Style="{TemplateBinding OverlayStyle}" />
                        <ContentPresenter Visibility="Collapsed" x:Name="BusyContent" ContentTemplate="{TemplateBinding BusyContentTemplate}">
                            <ContentPresenter.Content>
                                <Border BorderBrush="#feffff" BorderThickness="1" Background="#146984" Width="350" Height="125" HorizontalAlignment="Center" VerticalAlignment="Center">
                                    <Grid>
                                        <Label Foreground="White" FontFamily="DINbek" FontWeight="Light" FontSize="14" Height="25" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" VerticalAlignment="Top" Content="{TemplateBinding BusyTitle}"/>
                                        <StackPanel Orientation="Horizontal" Background="#ffffff" Margin="2,25,2,2">
                                            <Viewport3D x:Name="PART_BusyImageContainer" Width="50" Height="50">
                                                <Viewport3D.Camera>
                                                    <PerspectiveCamera Position="0, 0, 3"/>
                                                </Viewport3D.Camera>
                                                <Viewport2DVisual3D  x:Name="PART_BusyImageVisual">
                                                    <Viewport2DVisual3D.Transform>
                                                        <RotateTransform3D>
                                                            <RotateTransform3D.Rotation>
                                                                <AxisAngleRotation3D Angle="0" Axis="0, 1, 0" />
                                                            </RotateTransform3D.Rotation>
                                                        </RotateTransform3D>
                                                    </Viewport2DVisual3D.Transform>
                                                    <Viewport2DVisual3D.Geometry>
                                                        <MeshGeometry3D Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0" TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>
                                                    </Viewport2DVisual3D.Geometry>
                                                    <Viewport2DVisual3D.Material>
                                                        <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
                                                    </Viewport2DVisual3D.Material>
                                                    <Image x:Name="PART_BusyImage" Source="{TemplateBinding BusyImage}" Width="50" Height="50" Stretch="Fill"></Image>
                                                </Viewport2DVisual3D>
                                                <ModelVisual3D>
                                                    <ModelVisual3D.Content>
                                                        <DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/>
                                                    </ModelVisual3D.Content>
                                                </ModelVisual3D>
                                            </Viewport3D>
                                            <Label Margin="10,0,0,0" Foreground="#146984" FontFamily="Arial" FontWeight="Bold" FontSize="14" HorizontalContentAlignment="Left" VerticalAlignment="Center" Content="{TemplateBinding BusyContent}"/>
                                        </StackPanel>
                                        <Image Height="18" Width="126" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,10" x:Name="PART_BusyLoadingImage" Source="{TemplateBinding BusyLoadingImage}"/>
                                    </Grid>
                                </Border>
                            </ContentPresenter.Content>
                        </ContentPresenter>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsBusy" Value="True">
                            <Setter TargetName="Content" Property="IsEnabled" Value="False"/>
                            <Setter TargetName="Overlay" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="BusyContent" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="BusyImageType" Value="None">
                            <Setter TargetName="PART_BusyImageContainer" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="BusyLoadingImageType" Value="None">
                            <Setter TargetName="PART_BusyLoadingImage" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>